]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell/window-tracker: Minor simplification
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 3 Jul 2020 15:28:45 +0000 (17:28 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 6 Jul 2020 14:59:51 +0000 (14:59 +0000)
Switching to autocleanup gives us a better separation between the
app/no-app cases.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/219

src/shell-window-tracker.c

index 0474f001451454c1730c93d0bbc2a0a99d18a386..8e17f2deb4f1ad097cc86b3a43affef28404f687 100644 (file)
@@ -214,7 +214,7 @@ get_app_from_id (MetaWindow  *window,
 {
   ShellApp *app;
   ShellAppSystem *appsys;
-  char *desktop_file;
+  g_autofree char *desktop_file = NULL;
 
   g_return_val_if_fail (id != NULL, NULL);
 
@@ -223,10 +223,9 @@ get_app_from_id (MetaWindow  *window,
   desktop_file = g_strconcat (id, ".desktop", NULL);
   app = shell_app_system_lookup_app (appsys, desktop_file);
   if (app)
-    g_object_ref (app);
+    return g_object_ref (app);
 
-  g_free (desktop_file);
-  return app;
+  return NULL;
 }
 
 /*